package com.atguigu.jxc.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.atguigu.jxc.dao.GoodsTypeDao;
import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.domain.SuccessCode;
import com.atguigu.jxc.entity.GoodsType;
import com.atguigu.jxc.entity.GoodsTypeVo;
import com.atguigu.jxc.service.GoodsTypeService;
import com.google.gson.JsonObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @description: 商品分类
 * @author: 化一帆
 * @date: 2023/2/10 11:52
 * @version: v1.0
 */
@Service
public class GoodTypeServiceImpl implements GoodsTypeService {
    @Autowired
    private GoodsTypeDao goodsTypeDao;

    /**
     * @description: 商品分类树的展示
     * @author 化一帆
     * @date 2023/2/10 12:46
     */
    @Override
    public String list() {
        List<GoodsTypeVo> goodsTypeVoList=goodsTypeDao.list();
        String s = JSONObject.toJSONString(goodsTypeVoList);
        return s;
    }

    /**
     * @description: 新增分类
     * @author 化一帆
     * @date 2023/2/10 19:01
     */

    /*@Override
    public ServiceVO save(String goodsTypeName, Integer pId) {
        goodsTypeDao.save(goodsTypeName,pId);
        return new ServiceVO(SuccessCode.SUCCESS_CODE, SuccessCode.SUCCESS_MESS);
    }*/
}
